﻿@page "/dockview-visible"

<Button OnClick="OnToggleVisible" Text="切换标签一"></Button>

<DockView Name="DockViewVisible" EnableLocalStorage="false" OnVisibleStateChangedAsync="OnVisibleStateChangedAsync">
    <DockContent Type="DockContentType.Column">
        <DockComponent Title="标签一" Visible="Visible">
            <BootstrapInput TValue="string"></BootstrapInput>
        </DockComponent>
        <DockComponent Title="标签二" ShowClose="false">
            <FetchData></FetchData>
        </DockComponent>
        <DockComponent Title="标签三" ShowClose="false">
            <Counter></Counter>
        </DockComponent>
    </DockContent>
</DockView>

@code {
    private bool Visible { get; set; } = true;

    private void OnToggleVisible()
    {
        Visible = !Visible;
    }

    private Task OnVisibleStateChangedAsync(string title, bool visible)
    {
        if (title == "标签一")
        {
            Visible = visible;
        }
        return Task.CompletedTask;
    }
}
